Skip to content

Fix DoubleRenderError on unsubscribe link for members with incomplete details - #2836

Merged
olleolleolle merged 1 commit into
masterfrom
fix/unsubscribe-double-render
Sep 2, 2026
Merged

Fix DoubleRenderError on unsubscribe link for members with incomplete details#2836
olleolleolle merged 1 commit into
masterfrom
fix/unsubscribe-double-render

Conversation

@mroderick

@mroderick mroderick commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

Rollbar items 660 and 559 report AbstractController::DoubleRenderError on GET /unsubscribe/:token.

MembersController#unsubscribe sets the member's session, then calls authenticate_member! and afterwards unconditionally redirects to subscriptions_path. For members whose profile is incomplete, finish_registration (inside authenticate_member!) already redirects to edit_member_details_path, so the second redirect raised DoubleRenderError. The cascade then bounced twice more: the inline rescue StandardError caught it and called redirect_to root_path on the already-performed response (#559), and the production rescue_from Exception handler failed to render the already-committed response (#660). One click, three chained render errors.

This only affects members who click an unsubscribe email link before completing registration details. Every other authenticate_member! caller runs it as a before_action, where Rails halts the chain on redirect — this was the only explicit call site.

Change

  • Guard the second redirect in unsubscribe with unless performed? (app/controllers/members_controller.rb:40). Members with incomplete details now land on the details page (the intended redirect); everyone else still reaches their subscriptions page. With the first conflict gone, neither the rescue arm nor the error handler can fire on a performed response, so both Rollbar items are fixed.
  • Add a controller spec for the incomplete-details path (spec/controllers/members_controller_spec.rb). The spec fails with the exact production error when the guard is reverted.

Verification

  • bundle exec rspec spec/controllers/members_controller_spec.rb — 3 examples, 0 failures
  • bundle exec rubocop on both changed files — no offenses
  • Mutation check: reverting the guard reproduces the production DoubleRenderError in the new spec

… details

MembersController#unsubscribe called authenticate_member! and then
unconditionally redirected to subscriptions_path. For members whose
profile is incomplete, finish_registration (inside authenticate_member!)
already redirects to edit_member_details_path, so the second redirect
raised AbstractController::DoubleRenderError (Rollbar item 660). Guard
the second redirect with `unless performed?` and add a regression spec
for the incomplete-details path.
@mroderick
mroderick force-pushed the fix/unsubscribe-double-render branch from 2a47704 to a39aad9 Compare September 2, 2026 10:08
@mroderick
mroderick marked this pull request as ready for review September 2, 2026 10:10

@olleolleolle olleolleolle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@olleolleolle
olleolleolle merged commit 75b77b8 into master Sep 2, 2026
10 checks passed
@olleolleolle
olleolleolle deleted the fix/unsubscribe-double-render branch September 2, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants